<!DOCTYPE html>
<html lang=zh>
<head>
    <!-- so meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="HandheldFriendly" content="True">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta name="description" content="1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586#!/bin/bash# 进入 screenscreen#添加用户addu">
<meta property="og:type" content="article">
<meta property="og:title" content="CentOS7 Setup">
<meta property="og:url" content="http://enomineCN.github.io/2016/12/01/centos7-setup/index.html">
<meta property="og:site_name" content="enomine">
<meta property="og:description" content="1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586#!/bin/bash# 进入 screenscreen#添加用户addu">
<meta property="og:updated_time" content="2017-04-28T08:27:09.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="CentOS7 Setup">
<meta name="twitter:description" content="1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586#!/bin/bash# 进入 screenscreen#添加用户addu">
    
    
        
          <link rel="shortcut icon" href="/images/favicon.ico">
        
        
          <link rel="icon" type="image/png" href="/images/favicon-192x192.png" sizes="192x192">
        
        
          <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png">
        
    
    <!-- title -->
    <title>CentOS7 Setup</title>
    <!-- styles -->
    <link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="/lib/meslo-LG/styles.css">
    <link rel="stylesheet" href="/lib/justified-gallery/justifiedGallery.min.css">
    <link rel="stylesheet" href="/css/style.css">
    <!-- rss -->
    
    
    <!-- jquery -->
    <script src="/lib/jquery/jquery.min.js"></script>
</head>

<body>
    
      <div id="header-post">
  <a id="menu-icon" href="#"><i class="fa fa-bars fa-lg"></i></a>
  <span id="menu">
    <span id="nav">
      <ul>
         
          <li><a href="/">Home</a></li>
         
          <li><a href="/about/">About</a></li>
         
          <li><a href="/archives/">Writing</a></li>
         
          <li><a href="http://github.com/enominecn">Projects</a></li>
        
      </ul>
    </span>
    <br/>
    <span id="actions">
      <span id="i-prev" class="info" style="display:none;">Previous post</span>
      <span id="i-next" class="info" style="display:none;">Next post</span>
      <span id="i-top" class="info" style="display:none;">Back to top</span>
      <span id="i-share" class="info" style="display:none;">Share post</span>
      <ul>
        
        <li><a class="icon" href="/2016/12/11/deploy-hexo-blog-to-vps-by-git-hook/"><i class="fa fa-chevron-left" aria-hidden="true" onmouseover='$("#i-prev").toggle();' onmouseout='$("#i-prev").toggle();'></i></a></li>
        
        
        <li><a class="icon" href="/2016/11/26/meta-classes-in-python/"><i class="fa fa-chevron-right" aria-hidden="true" onmouseover='$("#i-next").toggle();' onmouseout='$("#i-next").toggle();'></i></a></li>
        
        <li><a class="icon" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"><i class="fa fa-chevron-up" aria-hidden="true" onmouseover='$("#i-top").toggle();' onmouseout='$("#i-top").toggle();'></i></a></li>
        <li><a class="icon" href="#"><i class="fa fa-share-alt" aria-hidden="true" onmouseover='$("#i-share").toggle();' onmouseout='$("#i-share").toggle();' onclick='$("#share").toggle();return false;'></i></a></li>
      </ul>
    </span>
    <br/>
    <div id="share" style="display: none">
      <ul>
        <li><a class="icon" href="http://www.facebook.com/sharer.php?u=http://enomineCN.github.io/2016/12/01/centos7-setup/"><i class="fa fa-facebook" aria-hidden="true"></i></a></li>
        <li><a class="icon" href="https://twitter.com/share?url=http://enomineCN.github.io/2016/12/01/centos7-setup/&text=CentOS7 Setup"><i class="fa fa-twitter" aria-hidden="true"></i></a></li>
        <li><a class="icon" href="http://www.linkedin.com/shareArticle?url=http://enomineCN.github.io/2016/12/01/centos7-setup/&title=CentOS7 Setup"><i class="fa fa-linkedin" aria-hidden="true"></i></a></li>
        <li><a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url=http://enomineCN.github.io/2016/12/01/centos7-setup/&is_video=false&description=CentOS7 Setup"><i class="fa fa-pinterest" aria-hidden="true"></i></a></li>
        <li><a class="icon" href="mailto:?subject=CentOS7 Setup&body=Check out this article: http://enomineCN.github.io/2016/12/01/centos7-setup/"><i class="fa fa-envelope" aria-hidden="true"></i></a></li>
        <li><a class="icon" href="https://getpocket.com/save?url=http://enomineCN.github.io/2016/12/01/centos7-setup/&title=CentOS7 Setup"><i class="fa fa-get-pocket" aria-hidden="true"></i></a></li>
        <li><a class="icon" href="http://reddit.com/submit?url=http://enomineCN.github.io/2016/12/01/centos7-setup/&title=CentOS7 Setup"><i class="fa fa-reddit" aria-hidden="true"></i></a></li>
        <li><a class="icon" href="http://www.stumbleupon.com/submit?url=http://enomineCN.github.io/2016/12/01/centos7-setup/&title=CentOS7 Setup"><i class="fa fa-stumbleupon" aria-hidden="true"></i></a></li>
        <li><a class="icon" href="http://digg.com/submit?url=http://enomineCN.github.io/2016/12/01/centos7-setup/&title=CentOS7 Setup"><i class="fa fa-digg" aria-hidden="true"></i></a></li>
        <li><a class="icon" href="http://www.tumblr.com/share/link?url=http://enomineCN.github.io/2016/12/01/centos7-setup/&name=CentOS7 Setup&description="><i class="fa fa-tumblr" aria-hidden="true"></i></a></li>
      </ul>
    </div>
    <div id="toc">
      
    </div>
  </span>
</div>

    
    <div class="content index width mx-auto px2 my4">
        
        <article class="post" itemscope itemtype="http://schema.org/BlogPosting">
  <header>
    
    <h1 class="posttitle" itemprop="name headline">
        CentOS7 Setup
    </h1>



    <div class="meta">
      <span class="author" itemprop="author" itemscope itemtype="http://schema.org/Person">
        <span itemprop="name">enomine</span>
      </span>
      
    <div class="postdate">
        <time datetime="2016-12-01T03:12:22.000Z" itemprop="datePublished">2016-12-01</time>
    </div>


      
    <div class="article-tag">
        <i class="fa fa-tag"></i>
        <a class="tag-link" href="/tags/CentOS7/">CentOS7</a>
    </div>


    </div>
  </header>
  

  <div class="content" itemprop="articleBody">
    <figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div></pre></td><td class="code"><pre><div class="line"><span class="meta">#!/bin/bash</span></div><div class="line"></div><div class="line"><span class="comment"># 进入 screen</span></div><div class="line"></div><div class="line">screen</div><div class="line"></div><div class="line"><span class="comment">#添加用户</span></div><div class="line">adduser deploy</div><div class="line"></div><div class="line"><span class="comment"># 修改密码</span></div><div class="line">passwd deploy</div><div class="line"></div><div class="line"></div><div class="line"><span class="comment"># 允许 deploy su 到 root</span></div><div class="line">gpasswd <span class="_">-a</span> deploy wheel</div><div class="line"></div><div class="line"><span class="comment"># 添加登录公钥</span></div><div class="line">ssh-copy-id deploy@SERVER_IP_ADDRESS</div><div class="line"></div><div class="line"></div><div class="line">vi /etc/ssh/sshd_config</div><div class="line"><span class="comment"># 禁用 root 登录</span></div><div class="line">PermitRootLogin no</div><div class="line"><span class="comment"># 禁用密码登录</span></div><div class="line">PasswordAuthentication no</div><div class="line"><span class="comment"># 修改登录端口</span></div><div class="line">Port 2121</div><div class="line"><span class="comment"># 重启服务</span></div><div class="line">systemctl reload sshd</div><div class="line"></div><div class="line">cp /usr/lib/firewalld/services/ssh.xml /etc/firewalld/services/</div><div class="line">vi /etc/firewalld/services/ssh.xml</div><div class="line">firewall-cmd --reload</div><div class="line"></div><div class="line"><span class="comment"># !!!!! 连接确认</span></div><div class="line"></div><div class="line"></div><div class="line">yum -y update</div><div class="line"></div><div class="line"><span class="built_in">echo</span> <span class="string">"your host name"</span> &gt; /etc/hostname</div><div class="line"><span class="built_in">echo</span> <span class="string">"x.x.x.x your host name"</span> &gt;&gt; /etc/hosts</div><div class="line"></div><div class="line">reboot</div><div class="line"></div><div class="line">timedatectl <span class="built_in">set</span>-timezone Asia/Shanghai</div><div class="line"><span class="comment"># 设置 UTC 时间</span></div><div class="line">timedatectl <span class="built_in">set</span>-local-rtc 0</div><div class="line"></div><div class="line">yum groupinstall <span class="string">'Development Tools'</span></div><div class="line"></div><div class="line"><span class="comment"># install external release</span></div><div class="line">yum -y install epel-release</div><div class="line"></div><div class="line">yum -y install nginx</div><div class="line"></div><div class="line"><span class="comment"># required by pillow</span></div><div class="line">yum -y install freetype-devel libjpeg-devel libpng-devel</div><div class="line"></div><div class="line"><span class="comment"># required by sentry</span></div><div class="line">yum install libxslt-devel python-devel</div><div class="line"></div><div class="line">yum -y install npm</div><div class="line"></div><div class="line"><span class="comment"># required in bcrypt</span></div><div class="line">yum -y install libffi-devel</div><div class="line"></div><div class="line"><span class="comment"># mysqlclient</span></div><div class="line">yum -y install mariadb-devel</div><div class="line"></div><div class="line"></div><div class="line"><span class="comment"># install supervisor</span></div><div class="line">pip install supervisor --pre</div><div class="line"></div><div class="line"><span class="comment">#install python3</span></div><div class="line">wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz</div><div class="line">tar xf Python-3.5.2.tgz &amp;&amp; <span class="built_in">cd</span> Python-3.5.2 &amp;&amp; ./configure &amp;&amp; make &amp;&amp; make install</div><div class="line"></div><div class="line"></div><div class="line">su deploy</div><div class="line"><span class="built_in">cd</span> ~</div><div class="line"><span class="comment"># 重建 ssh keys (todo)</span></div><div class="line"></div><div class="line"><span class="comment"># 创建虚拟环境</span></div><div class="line">pyvenv venv3</div><div class="line"></div><div class="line"><span class="built_in">echo</span>_supervisord_conf &gt; supervisord.conf</div></pre></td></tr></table></figure>
  </div>
</article>



      </div>
    <footer id="footer">
  <div class="footer-left">
    Copyright &copy; 2017 enomine
  </div>
  <div class="footer-right">
    <nav>
      <ul>
         
          <li><a href="/">Home</a></li>
         
          <li><a href="/about/">About</a></li>
         
          <li><a href="/archives/">Writing</a></li>
         
          <li><a href="http://github.com/enominecn">Projects</a></li>
        
      </ul>
    </nav>
  </div>
</footer>

    <script src="/lib/justified-gallery/jquery.justifiedGallery.min.js"></script>
<script src="/js/main.js"></script>
<!-- Google Analytics -->

    <script type="text/javascript">
        (function(i,s,o,g,r,a,m) {i['GoogleAnalyticsObject']=r;i[r]=i[r]||function() {
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
        ga('create', 'UA-86660611-1', 'auto');
        ga('send', 'pageview');
    </script>

<!-- Disqus Comments -->


</body>
</html>
